#!/usr/bin/env bash

set -o nounset
set -o errexit
set -o pipefail

STARTUP_DIR="$( cd "$( dirname "$0" )" && pwd )"

source ${STARTUP_DIR}/../settings.sh

KUBECTL="kubectl --context=${KUBE_CONTEXT}"

ARGO_VERSION=v2.2.0

# for argo jobs
# grant admin privileges to the 'default' service account in the namespace 'default'
${KUBECTL} create rolebinding default-admin --clusterrole=admin --serviceaccount=default:default --dry-run -o yaml|${KUBECTL} apply -f -

${KUBECTL} create ns argo --dry-run -o yaml|${KUBECTL} apply -f -
${KUBECTL} apply -n argo -f "https://raw.githubusercontent.com/argoproj/argo/${ARGO_VERSION}/manifests/install.yaml"

